/* 	Construct.example
*	Module JS example
*	
*	IMPORTANT
*	Keep all code inside camelized module Object.
*	2 kinds of proper use: 
*	A) DOM Element class (direct output of html object)
*	B) Standard prototyped class 
*										*/

//	A) DOM Element class (prototypejs sugared)
//	Creates an extended HTML element.

var ConstructExample_A = function ( ) {
	
	Object.extend( obj = new Element("span", { id:'example', 'class':"example" }), ConstructExample_A_proto);
	
	return obj;
}

ConstructExample_A_proto = {
	example		: 0
}

Event.observe(window, "load", function() {
	//////////// Example
	$("container").insert( new ConstructExample_A() );
})






//	B) Standard prototyped class
//	This way you can easily create multiple objects.
//	Always keep in mind that the same module can be loaded mulitple times on the same page.

ConstructExample_B = function( obj )	{
	//// This is, of course, not always needed
	this.obj = (typeof obj == "string" )? $(obj) : obj;
}

ConstructExample_B.prototype =	{
	example		: 0

}

Event.observe(window, "load", function() {
	//////////// Example
	var example_B = new ConstructExample_B( 'example' );
	example_B.obj.update( "example" );
})

